$(function(){
	$("#reciprocal").click(registUser);
	
});

function registUser() {
	var radio = document.getElementsByName("optionsRadiosinline");
	for(var i=0;i<radio.length;i++){
		if(radio[i].checked){
			var ry_type = radio[i].value;
			
		}
	}
	var ry_paymoney = $("#ry_paymoney").val().trim();
	var ry_rule = $("#ry_rule").val().trim();
	var ry_content = $("#ry_content").val().trim();
	var ry_number = $("#ry_number").val().trim();
	var ry_time = $("#ry_time").val().trim();
	$("#ry_paymoney_span").html("");
	$("#ry_rule_span").html("");
	$("#ry_content_span").html("");
	$("#ry_number_span").html("");
	$("#ry_time_span").html("");
	var ok = true;
	if(ry_paymoney==""){
		ok=false;
		
		$("#count_span").html("支付金额为空");
	}
	if(ry_rule==""){
		ok=false;
		
		$("#name_span").html("具体规则为空空");
	}
	if(ry_content==""){
		ok=false;
//		$("#warning_2").show();
		$("#password_span").html("汇报内容为空");
	}
		
	
	if(ry_number==""){
		ok=false;
//		$("#warning_3").show();
		$("#f_password_span").html("人数上限为空");
	}
	if(ry_time==""){
		ok=false;
		$("#yzm_span").html("回报时间为空");
		
	}
	if(ok){
		$.ajax({
			url:base_path+"/repay/addRepay.do",
			type:"post",
			data:{"ry_type":ry_type,"ry_paymoney":ry_paymoney,"ry_rule":ry_rule,"ry_content":ry_content,"ry_number":ry_number ,"ry_time":ry_time},
		    dataType:"json",
		    success:function(result){
		    	if(result.status==0){
		    		alert(result.msg);
		    		window.location.href ="login.html";
		    		
		    	}else if(result.status==1){
		    		
					$("#count_span").html(result.msg);
		    	}
		    	
		    },
			error:function(){
		    		alert("注册异常");
		    	}
		});
		
	}
}